<template>
   <van-nav-bar title="用户购买的视频"   left-arrow @click-left="onClickLeft"/>
  <div v-for="(item,index) in dataList" :key="index">
     <video
        :src="item.originalUrl"
        autoplay
        muted
        preload="auto"
        class="fullscreen-video"
      ></video>
  </div>
</template>
<script setup lang="ts">
import { findUserVideoBuyList } from '../../api/search'
import { ref } from 'vue';
const dataList:any=ref({})
const userId = ref(parseInt(localStorage.getItem('userId') as string))
const sessionId = ref(JSON.parse(localStorage.getItem('sessionId') as string))
const findUserVideoBuyList1 = async () => {
  try {
    const res = await findUserVideoBuyList(userId.value, sessionId.value, {
      page: 1,
      count: 5
    })
   console.log("用户购买的视频",res.data.result);
   dataList.value=res.data.result;
  } catch (error) {
    console.error('获取用户信息失败:', error)
  }
}
// 调用获取数据的函数
findUserVideoBuyList1()
const onClickLeft = () => history.back();
</script>
<style>
.fullscreen-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /*视频内容覆盖整个容器，可能会被裁剪 */
}
</style>